package shared.pojo

import upickle.default._

/**
 * Created by yz on 13/7/2022
 */
object Pojo {

  trait FieldValueT

  case class ValidData(valid: Boolean, message: String = "")

  object ValidData {
    implicit val rw = macroRW[ValidData]
  }

  case class MemberAddData(account: String, password: String )

  object MemberAddData {
    implicit val rw = macroRW[MemberAddData]
  }

  object Login {

    case class Request(account: String, password: String)

    object Request {

      implicit val rw = macroRW[Request]

    }

    case class Response(valid: Boolean, role: String = "", token: String = "")

    object Response {

      implicit val rw = macroRW[Response]

    }

  }

  object ChangePassword {

    case class Request(account: String, password: String, newPassword: String)

    object Request {

      implicit val rw = macroRW[Request]

    }

    case class Response(valid: Boolean, role: String = "")

    object Response {

      implicit val rw = macroRW[Response]

    }

  }

  case class AccountData(account: String)

  object AccountData {

    implicit val rw = macroRW[AccountData]

  }

  case class IdData(id: Int)

  object IdData {

    implicit val rw = macroRW[IdData]

  }

  val sampleId = SampleId
  val freezerSet = FreezerSet

  val companyMember = CompanyMember

  val member = Member
  val specialMember = SpecialMember
  val wechatMember = WechatMember
  val sample = Sample
  val test = Test

  case class FilePathData(filePath: String)

  object FilePathData {

    implicit val rw = macroRW[FilePathData]

  }

  object UploadFile {

    case class Response(valid: Boolean, filePath: String)

    object Response {

      implicit val rw = macroRW[Response]

    }

  }

  case class MemberData(id: Int = 0, account: String = "", password: String = "", createTime: String = "")

  object MemberData {

    implicit val rw = macroRW[MemberData]

  }

  object ViewImage {

    case class Request(id: String, fileName: String)

    object Request {

      implicit val rw = macroRW[Request]

    }

  }

  case class UserInfo(account: String, role: String)

  object UserInfo {
    implicit val rw = macroRW[UserInfo]
  }

  case class ErrorResponse(error: String)

  object ErrorResponse {

    implicit val rw = macroRW[ErrorResponse]

  }

}
